<!--
 * @Descripttion: 已领取的客户
 * @Author: xiao li
 * @Date: 2020-07-06 12:17:07
 * @LastEditors: xiao li
 * @LastEditTime: 2021-04-29 14:02:54
-->
<template>
    <div class="lb-sys-sproconfig">
        <top-nav :title="navTitle" :isBack="true"></top-nav>

        <div class="page-main">
            <el-table
            v-loading="loading"
            :data="tableData"
          :header-cell-style="{background:'#f5f7fa',color:'#606266'}"
            style="width: 100%">
            <el-table-column
              prop="nickName"
              label="用户昵称">
            </el-table-column>
            <el-table-column
              prop="status_text"
              label="状态">
            </el-table-column>
          </el-table>

        <lb-page
          :batch='false'
          :page='searchForm.page'
          :pageSize='searchForm.limit'
          :total='total'
          @handleSizeChange='handleSizeChange'
          @handleCurrentChange='handleCurrentChange'
          >
        </lb-page>
        </div>
    </div>
</template>

<script>
export default {
  data () {
    return {
      navTitle: '',
      loading: false,
      searchForm: {
        id: 0,
        page: 1,
        limit: 10
      },
      tableData: []
    }
  },
  created () {
    let { id, uid } = this.$route.query
    this.searchForm.id = id
    this.searchForm.user_id = uid
    this.getTableDataList()
  },
  methods: {
    handleSizeChange (val) {
      this.searchForm.limit = val
      this.handleCurrentChange(1)
    },
    handleCurrentChange (val) {
      this.searchForm.page = val
      this.getTableDataList()
    },
    async getTableDataList (flag) {
      if (flag) this.searchForm.page = 1
      this.loading = true
      let {searchForm} = this
      let {code, data} = await this.$api.presentUserCouponList(searchForm)
      this.loading = false
      if (code !== 200) return
      this.tableData = data.data
      this.total = data.total
      this.navTitle = `已领取“${data.user_name}”分享此福利的客户`
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
